/*
 *  GWTurntableStopEffect.h
 *  GWGlitch
 *
 *  Created by Michael Forrest on 28/02/2008.
 *  Copyright 2008 Grimaceworks. All rights reserved.
 *
 */
#import "GWEffectBase.h"
#import "GWGlitchParameters.h"
class GWTurntableStopEffect : public GWEffectBase {
public:
	GWTurntableStopEffect(AUKernelBase * inKernel) : GWEffectBase(inKernel){Init();}

	virtual void 		Process(const Float32 *inSourceP,
								Float32		*inDestP,  
								UInt32 		inFramesToProcess,  
								UInt32		inNumChannels,  
								bool		&ioSilence);
	virtual void		Reset();
private:
	void	Init();
	enum{loopSize = 96000}; // 2 seconds
	Float32   mSampleLoop [loopSize];
	Float32	mLastPlaybackPosition;
	int		mLastRecordedPosition;
	Float32 mLastSampleValue;
	Float64	mSampleRate;
	Float32 mCurrentSpeed;
	Float32 MIN_STOP_RATE;
	Float32 MAX_STOP_RATE;
	float	mStopRate;
};